# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=xcat
pkgver=266.faaf8fe
pkgrel=8
pkgdesc='A command line tool to automate the exploitation of blind XPath injection vulnerabilities.'
url='https://github.com/orf/xcat'
groups=('blackarch' 'blackarch-exploitation' 'blackarch-automation')
depends=('python' 'python-ipgetter' 'python-colorama' 'python-xmltodict'
         'python-click' 'python-logbook' 'python-aiohttp' 'python-tqdm'
         'python-xpath-expressions' 'python-prompt_toolkit' 'python-cchardet'
         'python-aiodns' 'python-appdirs')
makedepends=('git' 'python-setuptools')
license=('MIT')
arch=('any')
source=("git+https://github.com/orf/$pkgname.git#commit=faaf8fe2d8f721723f1b4827fbf6b6c51c7a4770")
sha512sums=('SKIP')
install="$pkgname.install"

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i 's|xpath-expressions~=1.0|xpath-expressions|' setup.py
  sed -i 's|aiohttp~=3.0|aiohttp|' setup.py
}

build() {
  cd $pkgname

  python setup.py build
}

package() {
  cd $pkgname

  python setup.py install --root="$pkgdir" -O1 --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" *.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

